Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lora: Support RISC-V build, update to latest libtock-c and move to examples #432

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

alistair23
Copy link
Contributor

No description provided.

@alistair23 alistair23 force-pushed the alistair/lora-example branch 10 times, most recently from 432e65e to 2fff49e Compare May 16, 2024 12:12
Copy link
Contributor

@bradjc bradjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be upstreamed in this form. Adding RadioLib as a library like all other libtock-c external libraries would be great.

But this is too different from our current structure (adding maintenance overhead) and is too reliant on an external repository. This can lead to problems, like updating newlib to a version not here: https://github.com/jgromes/RadioLib/blob/master/examples/NonArduino/Tock/CMakeLists.txt and then libtock-c CI doesn't pass.

@alistair23
Copy link
Contributor Author

This feels a little like moving goal posts. This was moved to wip because it didn't build for RISC-V and would break the CI. Both of those issues are fixed. But now it has to include a custom build infrastructure.

The newlib path issue could easily be fixed by not using the version in the path, which is probably a good idea anyway.

I will have a look at re-implementing the build system, but I feel that this could be accepted in the meantime.

@alistair23
Copy link
Contributor Author

I created #443 to help with the hardcoded version paths

I also updated this to use TockLibrary.mk which should address the current issue

@alistair23
Copy link
Contributor Author

alistair23 commented Jun 17, 2024

This builds locally for me, in the CI I see

 (insn 179 178 46 8 (set (reg:SI 3 r3 [168])
        (mem/u/c:SI (plus:SI (reg:SI 12 ip [169])
                (unspec:SI [
                        (symbol_ref/u:SI ("*.LC1") [flags 0x2])
                    ] UNSPEC_PIC_SYM)) [0  S4 A32])) "../../../examples/lora/RadioLib/src/modules/LR11x0/LR11x0.cpp":629:16 929 {*thumb1_movsi_insn}
     (expr_list:REG_EQUAL (symbol_ref/u:SI ("*.LC1") [flags 0x2])
        (nil)))
during RTL pass: postreload
../../../examples/lora/RadioLib/src/modules/LR11x0/LR11x0.cpp:641:1: internal compiler error: in extract_constrain_insn, at recog.c:2195
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
make: *** [../../..//TockLibrary.mk:175: ../../..//examples/lora/RadioLib/build/cortex-m0/RadioLib/examples/lora/RadioLib/src/modules/LR11x0/LR11x0.o] Error 1

So maybe a GCC bug in older versions that pops up when not using the cmake infrastructure? Thoughts @bradjc?

@alistair23 alistair23 force-pushed the alistair/lora-example branch 5 times, most recently from 2d5ab8a to 9f7c65b Compare June 18, 2024 01:31
@lschuermann
Copy link
Member

Okay, so this builds with libtock-c's Makefiles and with RadioLib's cmake? Is there a good reason for us to keep using cmake if the libtock-c Makefiles work?

@alistair23
Copy link
Contributor Author

The cmake is a useful fall back. It's part of the RadioLib CI and tested regularly. The Tock system hits a GCC bug so it's isn't as robust

Copy link
Contributor

@bradjc bradjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to build with cmake out-of-tree, but we need PIC with our build system and want to avoid the overhead of supporting multiple build variations upstream.

Makefile Outdated Show resolved Hide resolved
Comment on lines -32 to -35
ifeq ($(strip $($(LIBNAME)_SRCS)),)
$(error Library "$(LIBNAME)" has no SRCS?)
endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@alistair23 alistair23 Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically when running the formatter in the CI, the submodules aren't cloned. So no SRCs are found as there are no wildcards.

This avoids that error.

@alistair23
Copy link
Contributor Author

It's fine to build with cmake out-of-tree, but we need PIC with our build system and want to avoid the overhead of supporting multiple build variations upstream.

Yeah, the cmake uses PIC as well.

The Tock system fails to build the LR11x0 module in the CI due to some GCC bug. So it's worth keeping the cmake around as an option for people who want to use the LR11x0 module.

@ppannuto
Copy link
Member

ppannuto commented Jul 8, 2024

Hmm.. I'm of two minds on the cmake issue.

I do think there is probably some utility in an example that shows how one could integrate libtock with an external build system, but I'm also very wary of keeping anything like that around as a first-class example that we have limited control over and an obligation to support :/.

If we keep it around, I'd want CI to test it. I also have gone through Herculean efforts to ensure that minimal/standard tooling (i.e. just vanilla make) is all that is needed to get up-and-running with Tock, which we've gotten a ton of positive feedback on over the years as a design choice, and requiring cmake would run against that. I also try very hard to make sure that anything that runs as CI in the cloud is 'easy' to run locally; though there it's probably easy to follow a path similar to qemu where the local CI can run it, but wouldn't pull it in by default.... /endStreamOfConsciousness

I think I lean at the moment towards:

  • We should include the cmake as example
  • It should be built in a separate, non-required-to-merge "third-party-build" or similar CI job; this lets us see when something goes awry, while de-risking a third-party change holding up core development

@alistair23 alistair23 force-pushed the alistair/lora-example branch 2 times, most recently from 158fafb to e0ddbe6 Compare July 9, 2024 00:22
@alistair23
Copy link
Contributor Author

I removed the cmake option

ppannuto
ppannuto previously approved these changes Jul 16, 2024
Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay dropping that 'empty lib srcs' check. I don't think that's the hardest thing to track down as an issue if you mess it up.

alistair23 and others added 8 commits July 30, 2024 19:10
avoid a wildcard with `rm -rf` in a script, and set the script
to error out if it's somehow not in the directory we expect
before `rm`'ing
Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
@alistair23
Copy link
Contributor Author

Ping!

It would be great to get this merged so then #456 can go ahead

@alistair23
Copy link
Contributor Author

Ping!

Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent here is for the RadioLib to be re-built on-demand if there are changes, correct? That shouldn't use EXTERN_LIBS anywhere, see https://github.com/tock/libtock-c/blob/master/doc/compilation.md#compiling-libraries-for-tock

examples/lora/sensor-receive/Makefile Outdated Show resolved Hide resolved
examples/lora/sensor-receive/Makefile Outdated Show resolved Hide resolved
Copy link
Member

@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By no means an expert on the libtock-c build system, but superficially this looks good to me.

@alistair23
Copy link
Contributor Author

Ping!

1 similar comment
@alistair23
Copy link
Contributor Author

Ping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants